import UIKit
import Foundation



var continueDict:[String:String] = ["zh-CN": "继续",
                                          "zh-Hans":"继续",
                                          "en": "continue",
                                          "fr": "continuer",
                                          "th": "ดำเนินการต่อ",
                                          "ko": "계속하다",
                                          "ja": "続く",
                                          "it": "Continua",
                                          "es": "continuar",
                                          "ru": "продолжать",
                                          "uk": "продовжувати",
                                          "ar": "يكمل",
                                          "fa": "ادامه هید"]


let EVENT_NAME_PRODUCT_LOAD="product_load"
let EVENT_NAME_REFRESH_VIP_STATE = "purchase_sucess"
let EVENT_NAME_DELETE_ROLE="delete_role"
let EVENT_NAME_UPDATE_HOME_ROLE="update_home_role"
let EVENT_NAME_SELECT_ROLE="select_role"
let EVENT_NAME_ADD_ROLE = "add_role"
let key_bid = "key_bid"
let key_version = "key_version"
let senderId = "000001"
let receiverId = "000002"
let senderName = ""
let haveNoTryCount = "免费提问次数已用完"
let isNotVip = "还不是会员"
let defaultHomeRoleDescription = "Hi，我是你的AI智能助手，你可以问我任何问题."


struct BasicPageParameters: Encodable {
    let page: Int
}

struct CoinsParameters: Encodable {
    let coins: Double
    let fromPage: String

}

struct BasicParameters: Encodable {

}


struct SuggestParameters: Encodable {

    let content: String

}


struct CompletionImageParameters: Encodable {
   
    let size: String
    let prompt: String
    
}

struct CompletionParameters: Encodable {
    let prompt: String
    let contentLengthType: Int
    let type: Int
    let rolePrompt: String
    
}


struct HistoryParameters: Encodable {
    
    let type: Int
}
extension UIView {
    //radius:切圆角的半径
    //corner:要切四个角中的哪个角
    func cornerCut(radius:Int,corner:UIRectCorner){
        let maskPath = UIBezierPath.init(roundedRect: bounds, byRoundingCorners: corner, cornerRadii: CGSize.init(width: radius, height: radius))
        let maskLayer = CAShapeLayer()
        maskLayer.frame = bounds
        maskLayer.path = maskPath.cgPath
        layer.mask = maskLayer
    }
}



import Foundation
import UIKit
 
var expandSizeKey = "expandSizeKey"
 
extension UIButton {
    
    open func lzh_expandSize(size:CGFloat) {
        objc_setAssociatedObject(self, &expandSizeKey,size, objc_AssociationPolicy.OBJC_ASSOCIATION_COPY)
    }
    
    private func expandRect() -> CGRect {
        let expandSize = objc_getAssociatedObject(self, &expandSizeKey)
        if (expandSize != nil) {
            return CGRect(x: bounds.origin.x - (expandSize as! CGFloat), y: bounds.origin.y - (expandSize as! CGFloat), width: bounds.size.width + 2*(expandSize as! CGFloat), height: bounds.size.height + 2*(expandSize as! CGFloat))
        }else{
            return bounds;
        }
    }
    
    open override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
        let buttonRect =  expandRect()
        if (buttonRect.equalTo(bounds)) {
            return super.point(inside: point, with: event)
        }else{
            return buttonRect.contains(point)
        }
    }
}
 

